package com.tg.app.camera;

import com.appbase.custom.base.TemperatureHumiditySettingBean;
import com.tg.appcommon.android.Packet;

public class Tcis_GetTemperatureSettingReq {
    public static byte[] parseContent(boolean temper, TemperatureHumiditySettingBean temperatureHumiditySettingBean) {
        byte[] result = new byte[20];
        byte[] bSensId = Packet.intToByteArray_Little(0);
        System.arraycopy(bSensId, 0, result, 0, 4);

        byte[] lo_en = Packet.intToByteArray_Little(temperatureHumiditySettingBean.lo_en);
        System.arraycopy(lo_en, 0, result, 4, 4);

        byte[] hi_en = Packet.intToByteArray_Little(temperatureHumiditySettingBean.hi_en);
        System.arraycopy(hi_en, 0, result, 8, 4);

        byte[] lo_threshold;
        if (temper){
            lo_threshold = Packet.intToByteArray_Little(temperatureHumiditySettingBean.lo_threshold * 1000);
        }else{
            lo_threshold = Packet.intToByteArray_Little(temperatureHumiditySettingBean.lo_threshold * 10);
        }
        System.arraycopy(lo_threshold, 0, result, 12, 4);

        byte[] hi_threshold;
        if (temper){
            hi_threshold = Packet.intToByteArray_Little(temperatureHumiditySettingBean.hi_threshold * 1000);
        }else{
            hi_threshold = Packet.intToByteArray_Little(temperatureHumiditySettingBean.hi_threshold * 10);
        }
        System.arraycopy(hi_threshold, 0, result, 16, 4);

        return result;
    }
}
